package twLogicQuiz

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("PUT")
        url(value(producer("/api/tw-logic-quizzes/1")
                , consumer(regex("/api/tw-logic-quizzes/\\d+"))))
        body("""
              {    "hardCount":2,
                   "normalCount":8,
                   "easyCount":4,
                   "timeBoxInMinutes":20
                   }
                """)
        bodyMatchers {
            jsonPath('$.hardCount', byRegex(number()))
            jsonPath('$.normalCount', byRegex(number()))
            jsonPath('$.easyCount', byRegex(number()))
            jsonPath('$.timeBoxInMinutes', byRegex(number()))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }
    response {
        status(204)
    }
}
